<?php
	include "inc/userAuth.php";
	$gender = "";
	$lastName = "";
	$firstName = "";
	$dd = "";
	$mm = "";
	$yyyy = "";
	$email = "";
	$phoneNumber = "";
	$checkTerms = 0;
		include "conn/database.php";
		$sql = "SELECT * FROM `T_PERSON` WHERE PERSON_SID = '".$_SESSION['guid']."' limit 1";
		$res = mysql_query($sql);
		$rows = mysql_num_rows($res);
		if($rows>0){
			$result = mysql_fetch_array($res);
			$gender = $result['GENDER'];
			$lastName = $result['SURNAME'];
			$firstName = $result['FIRST_NAME'];
			
			$date = explode("-",$result['BIRTHDATE']);
			$dd = $date[2];
			$mm = $date[1];
			$yyyy = $date[0];
			
			$email = $result['EMAIL_ADDRESS'];
			$phoneNumber = $result['PHONE_NUMBER'];
			$checkTerms = $result['WANT_NEWS'];
		} else echo "error! No person id selected.";
?>
<!DOCTYPE html>
<html>
<head>
<meta name="Description" content="Une application mobile unique pour un mariage unique.">
<meta name="Keywords" content="wedding box, mariage, application mobile, appstore, google play, iphone, android, iphone 5, samsung galaxy s3, promesse d'une vie">
<title>Promesse d'une Vie</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link type="text/css" rel="stylesheet" media="screen" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.7.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/wedding_form.js" charset="utf-8"></script>

</head>

<body>	
	<div class="main-content">
		<?php
			include "left-menu.php";
		?>
		
		<div class="right">
			<div id="left-shadow"></div>
			<div class="welcome relative">
				<a id="click-drop"><span>Bonjour <?php echo $_SESSION['fname']?></span></a>
				<a type="button" class="deconnect" value="" name="deconnect" id="bien-deconnect" style="display:none;"/></a>
			</div>
			
			<div class="title">
				<h2>Profil de l’administrateur</h2>
			</div>
			
			<form method="post" action="inc/editperson.php" class="wedding_form relative" id="compte-1">
				<div class="showText"></div>
				
				<input name="dd" id="dd" class="select_value" type="hidden" value="<?php echo $dd; ?>"/>
				<input name="mm" id="mm" class="select_value" type="hidden" value="<?php echo $mm; ?>"/>
				<input name="yyyy" id="yyyy" class="select_value" type="hidden" value="<?php echo $yyyy; ?>"/>
					<div class="form_text miniline">
						<div class="form_select">
								<p class="select_show">Séléctionnez le genre</p>
								<div class="select_options" style="display:none;">
									<a class="select_option" val="MALE">Mr<span class="selectable_opacity"></span></a>
									<a class="select_option" val="FEMALE">Mme<span class="selectable_opacity"></span></a>
								</div>
								<input name="gender" class="select_value" type="hidden" value="<?php echo $gender; ?>"/>
						</div>
					</div>
						
					<div class="form_text miniline">
						  <input type="text" id="lastName" name="lastName" value="<?php echo $lastName; ?>" placeholder="Nom*"/>
					</div>
					
					<div class="form_text miniline">
							<input type="text" id="firstName" name="firstName" value="<?php echo $firstName; ?>" placeholder="Prénom*"/>
					</div>
					
					<div class="form_text miniline">
						<input type="email" id="email" name="email" value="<?php echo $email; ?>" disabled="disabled" placeholder="Adresse e-mail*"/>
					</div>
					
					<div class="form_text miniline">
						<input type="text" id="phoneNumber" name="phoneNumber" placeholder="Téléphone" value="<?php echo $phoneNumber; ?>" maxlength="10"/>
					</div>
					
					<div class="form_checkbox" style="margin-top:-15px;">
						<input class="checkbox_value" type="hidden" name="checkTerms"id="checkTerms" value="<?php echo $checkTerms; ?>"/>
						<div class="checkbox_option"><span class="checkbox_icon"></span>Je souhaite recevoir de l’information de la part de Promesse d’une Vie.</div>
					</div>
			
					<input type="submit" value="Enregister" name="submit" class="btn-save1 button" />
			</form>
			
			<div id="sep-line"></div>
			<div class="title">
				<h2>Changer le mot de passe</h2>
				<p style="font-size:14px;">Pour modifier votre mot de passe, veuillez d’abord entrer l’ancien.<br /> 
Entrez ensuite le nouveau à deux reprises. </p>
			</div>
			
			<form method="post" action="inc/changepw.php" class="wedding_form relative" id="compte-2">		
				<div class="showText"></div>
					<div class="form_text miniline">
						  <input type="password" id="oldcode" name="oldcode" placeholder="Mot de passe initial" maxlength="20"/>
							<p class="entre5">Entre 5 - 20 caractères</p>
					</div>
					
					<div class="form_text miniline">
							<input type="password" id="newcode" name="newcode" placeholder="Nouveau mot de passe" maxlength="20"/>
							<p class="entre5">Entre 5 - 20 caractères</p>
					</div>
					
					<div class="form_text miniline">
						<input type="password" id="con-newcode" name="con-newcode" placeholder="Confirmation du nouveau mot de passe" maxlength="20"/>
						<p class="entre5">Entre 5 - 20 caractères</p>
					</div>
					
					<input type="submit" value="Enregister le mot de passe" name="submit" class="btn-save-mdp button" />
		  </form>
			
			
		</div>
	</div>
</body>

</html>